<?php include_once 'include/func.class.php';?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
$div=$_GET['div'];
switch($div){
	case 'employee':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from employee where id=$id"));
?>
<div id="employee_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Employee</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
          <tr>
            <td height="35" align="right">Name:</td>
            <td ><input name="e_name" type="text" class="input_title_bg" value="<?php echo $row['e_name']?>" />
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Birthday：</td>
            <td ><input type="text" name="e_birthday" id="e_birthday" value="<?php echo date("Y-m-d",$row['e_birthday'])?>"  onfocus="WdatePicker({el:$dp.$('e_birthday')})" class="input_title_bg"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Phone Number：</td>
            <td ><input name="e_tel" type="text" class="input_title_bg"  value="<?php echo $row['e_tel']?>"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Work time：</td>
            <td ><input type="text" name="e_jtime" id="e_jtime" value="<?php echo date("Y-m-d",$row['e_jtime'])?>"  onfocus="WdatePicker({el:$dp.$('e_jtime')})" class="input_title_bg"/>
              <span class="red">*</span></td>
          </tr>
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" id="action" value="<?php echo $id==''?'add':'edit'; ?>" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'product':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from product where id=$id"));
?>
<div id="product_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Product</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
          <tr>
            <td height="35" align="right">Name：</td>
            <td ><input name="title" type="text" class="input_title_bg" value="<?php echo $row['title']?>" />
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Price：</td>
            <td ><input name="price" type="text"  class="input_title_bg" value="<?php echo $row['price']?>"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Stock：</td>
            <td ><input name="recount" type="text" class="input_title_bg"  value="<?php echo $row['recount']?>"/>
              <span class="red">*</span></td>
          </tr>
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="<?php echo $id==''?'add':'edit'; ?>" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'account':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from $div where id=$id"));
$query=mysql_query("select * from member");
$memberlist=array();
while($value=mysql_fetch_array($query))
{
	$memberlist[$value['id']]=$value;
}

$query=mysql_query("select * from employee");
$employeelist=array();
while($value=mysql_fetch_array($query))
{
	$employeelist[$value['id']]=$value;
}
$query=mysql_query("select * from product");
$productlist=array();
while($value=mysql_fetch_array($query))
{
	$productlist[$value['id']]=$value;
}
?>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Account</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
        <tr>
            <td height="35" align="right">Member Name:</td>
            <td ><select class="input_title_bg" name="member">
                <?php foreach($memberlist as $member){ ?>
                <option value="<?php echo $member["id"];?>" <?php if($member["id"]==$row["memberid"]) echo "selected";?>><?php echo $member["m_name"];?></option>
                <?php } ?>
                 </select>
              <span class="red">*</span></td>
          </tr>
          
          <tr>
            <td height="35" align="right">Product Name:</td>
            <td ><select class="input_title_bg" name="product">
                <?php foreach($productlist as $product){ ?>
                <option value="<?php echo $product["id"];?>" <?php if($product["id"]==$row["productid"]) echo "selected";?>><?php echo $product["title"];?></option>
                <?php } ?>
                 </select>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Price:</td>
            <td ><input name="price" type="text" class="input_title_bg"  value="<?php echo $row['price']?>"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Quantity:</td>
            <td ><input name="quantity" type="text" class="input_title_bg"  value="<?php echo $row['quantity']?>"/>
              <span class="red">*</span></td>
          </tr>
          
          <tr>
            <td height="35" align="right">Employee Name:</td>
            <td ><select class="input_title_bg" name="employee">
                <?php foreach($employeelist as $employee){ ?>
                <option value="<?php echo $employee["id"];?>" <?php if($employee["id"]==$row["employeeid"]) echo "selected";?>><?php echo $employee["e_name"];?></option>
                <?php } ?>
                 </select>
              <span class="red">*</span></td>
          </tr>
          
          <tr>
            <td height="35" align="right">Selling time：</td>
            <td ><input type="text" name="sellingtime" id="sellingtime" value="<?php echo date("Y-m-d",$row['dateline'])?>"  onfocus="WdatePicker({el:$dp.$('sellingtime')})" class="input_title_bg"/>
              <span class="red">*</span></td>
          </tr>
          
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="<?php echo $id==''?'add':'edit'; ?>" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'member':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from member where id=$id"));
?>
<div id="member_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Member</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
          <tr>
            <td height="35" align="right">Name:</td>
            <td ><input name="m_name" type="text" class="input_title_bg" value="<?php echo $row['m_name']?>" />
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Birthday:</td>
            <td ><input name="m_birthday" type="text"  class="input_title_bg" id="m_birthday" value="<?php echo date('Y-m-d',$row['m_birthday'])?>" onfocus="WdatePicker({el:$dp.$('m_birthday')})"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Phone Number:</td>
            <td ><input name="m_tel" type="text" class="input_title_bg"  value="<?php echo $row['m_tel']?>"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">E-mail:</td>
            <td ><input name="m_mail" type="text" class="input_title_bg"  value="<?php echo $row['m_mail']?>"/>
              <span class="red">*</span></td>
          </tr>
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="<?php echo $id==''?'add':'edit'; ?>" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'webconfig':
	  $row = mysql_fetch_array(mysql_query("select * from webconfig"));
?>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Webconfig</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="checkall.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
          <tr>
            <td height="35" align="right">Management account：</td>
            <td ><input name="username" type="text" class="input_title_bg" value="<?php echo $_SESSION['admin']?>" />
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Management password：</td>
            <td ><input name="password" type="password"  class="input_title_bg" />
              <span class="red">*Do not modify blank</span></td>
          </tr>
          <tr>
            <td width="25%" height="35" align="right">System name：</td>
            <td width="75%"><input type="text" name="webname" id="webname" value="<?php echo $row['webname']; ?>" class="class_input" /></td>
          </tr>
          <tr>
            <td width="25%" height="35" align="right">Key word set：</td>
            <td width="75%"><input type="text" name="keyword" id="keyword" value="<?php echo $row['keyword']; ?>" class="class_input" /></td>
          </tr>
          <tr>
            <td width="25%" height="116" align="right">System description：</td>
            <td width="75%"><textarea name="description" id="description" class="class_areatext"><?php echo $row['description']; ?></textarea></td>
          </tr>
          <tr>
            <td width="25%" height="116" align="right">Page Footing：</td>
            <td width="75%"><textarea name="copyright" id="copyright" class="class_areatext"><?php echo $row['copyright']; ?></textarea></td>
          </tr>
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="editcon" />
        </div>
      </form>
    </div>
  </div>
</div>

<?php break;
      case 'mail':
	  $row = mysql_fetch_array(mysql_query("select * from mail_config"));
?>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Mail_set</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:10px;">
      <form action="checkall.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
				<tr>
						<td width="21%" height="35" align="right">SMTP host：</td>
						<td width="79%"><input type="text" name="host" value="<?php echo $row['m_host']; ?>" class="class_input" /><span class="cnote">example：smtp.qq.com</span></td>
				</tr>
				<tr>
						<td width="21%" height="35" align="right">SMTP port：</td>
						<td width="79%"><input type="text" name="port"  value="<?php echo $row['m_port']; ?>" class="class_input" /><span class="cnote">General port 25, if SSL is the way, may be 465</span></td>
				</tr>
                <tr>
						<td width="21%" height="35" align="right">Mail user：</td>
						<td width="79%"><input type="text" name="user" value="<?php echo $row['m_user']; ?>" class="class_input" /><span class="cnote">example：12345678@qq.com</span></td>
				</tr>
				<tr>
						<td width="21%" height="35" align="right">Password：</td>
				  <td width="79%"><input type="password" name="pass" value="<?php echo $row['m_pass']; ?>" class="class_input" /><span class="cnote">Password for the mailbox</span></td>
				</tr>
                <tr>
						<td width="21%" height="35" align="right">Send mail：</td>
				  <td width="79%"><input type="text" name="from" value="<?php echo $row['m_from']; ?>" class="class_input" /><span class="cnote">The other received the message displayed when the sender e-mail address</span></td>
				</tr>
                <tr>
						<td width="21%" height="35" align="right">Administrator Mail Address：</td>
				  <td width="79%"><input type="text" name="reply" value="<?php echo $row['m_reply']; ?>" class="class_input" /><span class="cnote">The other party to reply to a message when the default reply e-mail address</span></td>
		  </tr>
                <tr>
						<td width="21%" height="35" align="right">Mail content：</td>
				  <td width="79%"><textarea style="width:500px; height:60px;" name="" cols="" rows=""></textarea></td>
		  </tr>
                <input type="hidden" name="ssl"  value="<?php echo $row['m_ssl']; ?>" class="class_input" />
  </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="editcon" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'archive':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from archive where id=$id"));
?>
<div id="archive_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Archive</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
          <tr>
            <td height="35" align="right">Name:</td>
            <td ><input name="e_name" type="text" class="input_title_bg" value="<?php echo $row['e_name']?>" />
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Birthday：</td>
            <td ><input type="text" name="e_birthday" id="e_birthday" value="<?php echo date("Y-m-d",$row['e_birthday'])?>"  onfocus="WdatePicker({el:$dp.$('e_birthday')})" class="input_title_bg"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Phone Number：</td>
            <td ><input name="e_tel" type="text" class="input_title_bg"  value="<?php echo $row['e_tel']?>"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Work time：</td>
            <td ><input type="text" name="e_jtime" id="e_jtime" value="<?php echo date("Y-m-d",$row['e_jtime'])?>"  onfocus="WdatePicker({el:$dp.$('e_jtime')})" class="input_title_bg"/>
              <span class="red">*</span></td>
          </tr>
           <tr>
            <td height="35" align="right">Stauts：</td>
            <td ><input name="e_status" type="text" class="input_title_bg"  value="<?php echo $row['e_status']?>"/>
              <span class="red">*</span></td>
          </tr>  
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" id="action" value="<?php echo $id==''?'add':'edit'; ?>" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'sales':
?>
<?php 
$id=$_REQUEST['id'];
$query=mysql_query("select * from account where productid=$id");
$datalist=array();
while($value=mysql_fetch_array($query))
{
	$datalist[$value["id"]]=$value;
}
$query=mysql_query("select * from member");
$memberlist=array();
while($value=mysql_fetch_array($query))
{
	$memberlist[$value['id']]=$value;
}

$query=mysql_query("select * from archive");
$employeelist=array();
while($value=mysql_fetch_array($query))
{
	$employeelist[$value['id']]=$value;
}
$query=mysql_query("select * from product");

?>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Sales</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:20px;">
        <?php if(!empty($datalist)){ ?>
        <table border="0" cellspacing="1" cellpadding="1" bgcolor="#e34681">
            <tr height="30" bgcolor="#e34681" style="color:#FFF;">
              <td width="60" align="left">Sales ID</td>
              <td width="102" align="left">Member Name</td>
              <td width="82" align="left">Price</td>
              <td width="82" align="left">Quantity</td>
              <td width="102" align="left">Employee Name</td>
              <td width="114" align="left">Selling Time</td>
            </tr>
            <?php foreach($datalist as $row) { ?>
            <?php if(!empty($memberlist[$row["memberid"]]['m_name'])){?>
            <tr height="30" bgcolor="#FFFFFF">
              <td><?php echo $row['id']?></td>
              <td align="left"><?php echo $memberlist[$row["memberid"]]['m_name']?></td>
              <td align="left"><?php echo $row['price']?></td>
              <td align="left"><?php echo $row['quantity']?></td>
              <td align="left"><?php echo $employeelist[$row['employeeid']]['e_name']?></td>
              <td align="left"><?php echo date("Y-m-d",$row['dateline'])?></td>
            </tr>
            <?php } ?>
            <?php }?>
          </table>
          <?php }else{ ?>
          <ul align="center">
            <li style="padding:30px;">No information</li>
          </ul>
          <?php }?>
        <div class="gray_add_bottom">
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
   
        </div>
    </div>
  </div>
</div>
<?php break;
      case 'consume':
?>
<?php 
$id=$_REQUEST['id'];
$query=mysql_query("select * from account where memberid=$id");
$datalist=array();
$monthlist=array();
$yearlist=array();
$m_total=0;
$y_total=0;
$a_total=0;
while($value=mysql_fetch_array($query))
{
	if($value["dateline"]>=(time()-2592000))
	{
	    $monthlist[$value["id"]]=$value;
	    $m_total=$m_total+$value["quantity"]*$value["price"];
	}
    if($value["dateline"]>=(time()-62208000))
    {
	    $yearlist[$value["id"]]=$value;
	    $y_total=$y_total+$value["quantity"]*$value["price"];
    }
	$datalist[$value['id']]=$value;
	$a_total=$a_total+$value["quantity"]*$value["price"];    
}
$query=mysql_query("select * from product");
$productlist=array();
while($value=mysql_fetch_array($query))
{
	$productlist[$value['id']]=$value;
}

$query=mysql_query("select * from employee");
$employeelist=array();
while($value=mysql_fetch_array($query))
{
	$employeelist[$value['id']]=$value;
}
$query=mysql_query("select * from product");

?>
<script language="JavaScript" type="text/javascript" src="js/jquery.lixtabs.js"></script>
<link href="css/Tabs.css" rel="stylesheet" type="text/css" />

<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Sales</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:20px;">
        <div id="tab2">
        <div class="tabhead" style="width:96.7%"> 
        <a href="#" class="cur">All</a>
        <a href="#">Month</a>
        <a href="#">Year</a>
        
        </div>
        <div class="tabcon">
        <div class=snow id="alllist" style="display:block">
        <?php if(!empty($datalist)){ ?>
        <table  border="0" cellspacing="1" cellpadding="1" bgcolor="#e34681">
            <tr height="30" bgcolor="#e34681" style="color:#FFF;">
              <td width="60" align="left">Sales ID</td>
              <td width="102" align="left">Product Name</td>
              <td width="82" align="left">Price</td>
              <td width="82" align="left">Quantity</td>
              <td width="102" align="left">Employee Name</td>
              <td width="114" align="left">Selling Time</td>
            </tr>
            <?php foreach($datalist as $row) { ?>
            <tr height="30" bgcolor="#FFFFFF">
              <td><?php echo $row['id']?></td>
              <td align="left"><?php echo $productlist[$row["productid"]]['title']?></td>
              <td align="left"><?php echo $row['price']?></td>
              <td align="left"><?php echo $row['quantity']?></td>
              <td align="left"><?php echo $employeelist[$row['employeeid']]['e_name']?></td>
              <td align="left"><?php echo date("Y-m-d",$row['dateline'])?></td>
            </tr>
            <?php }?>
            <tr><th colspan="6" bgcolor="#FFFFF">Total Expenses:<?php echo $a_total?></th></tr>
          </table>
          <?php }else{ ?>
          <ul align="center">
            <li style="padding:30px;">No information</li>
          </ul>
          <?php }?>
          </div>
          <div id="monthlist" class="hide snow" style="display:none">
           <?php if(!empty($monthlist)){ ?>
            <table border="0" cellspacing="1" cellpadding="1" bgcolor="#e34681">
            <tr height="30" bgcolor="#e34681" style="color:#FFF;">
              <td width="60" align="left">Sales ID</td>
              <td width="102" align="left">Product Name</td>
              <td width="82" align="left">Price</td>
              <td width="82" align="left">Quantity</td>
              <td width="102" align="left">Employee Name</td>
              <td width="114" align="left">Selling Time</td>
            </tr>
            
            <?php foreach($monthlist as $row) { ?>
            <tr height="30" bgcolor="#FFFFFF">
              <td><?php echo $row['id']?></td>
              <td align="left"><?php echo $productlist[$row["productid"]]['title']?></td>
              <td align="left"><?php echo $row['price']?></td>
              <td align="left"><?php echo $row['quantity']?></td>
              <td align="left"><?php echo $employeelist[$row['employeeid']]['e_name']?></td>
              <td align="left"><?php echo date("Y-m-d",$row['dateline'])?></td>
            </tr>
            <?php }?>
            <tr><th colspan="6" bgcolor="#FFFFF">Total Expenses:<?php echo $m_total?></th></tr>
          </table>
          <?php }else{ ?>
          <ul align="center">
            <li style="padding:30px;">No information</li>
          </ul>
          <?php }?>
          </div>
          <div id="yearlist" class="hide snow" style="display:none">
           <?php if(!empty($yearlist)){ ?>
            <table  border="0" cellspacing="1" cellpadding="1" bgcolor="#e34681">
            <tr height="30" bgcolor="#e34681" style="color:#FFF;">
              <td width="60" align="left">Sales ID</td>
              <td width="102" align="left">Product Name</td>
              <td width="82" align="left">Price</td>
              <td width="82" align="left">Quantity</td>
              <td width="102" align="left">Employee Name</td>
              <td width="114" align="left">Selling Time</td>
            </tr>
            <?php foreach($yearlist as $row) { ?>
            <tr height="30" bgcolor="#FFFFFF">
              <td><?php echo $row['id']?></td>
              <td align="left"><?php echo $productlist[$row["productid"]]['title']?></td>
              <td align="left"><?php echo $row['price']?></td>
              <td align="left"><?php echo $row['quantity']?></td>
              <td align="left"><?php echo $employeelist[$row['employeeid']]['e_name']?></td>
              <td align="left"><?php echo date("Y-m-d",$row['dateline'])?></td>
            </tr>
            <?php }?>
            <tr><th colspan="6" bgcolor="#FFFFF">Total Expenses:<?php echo $y_total;?></th></tr>
          </table>
          <?php }else{ ?>
          <ul align="center">
            <li style="padding:30px;">No information</li>
          </ul>
          <?php }?>
          </div>
          </div><!--Tab con-->
          </div><!--Tab2-->
          <script language="JavaScript" type="text/javascript">
              $('#tab2').Xtabs({hdcn:'tabhead',bdcn:'tabcon',bdtagcur:'show',event:'mouseover',how:'fadeIn'}) 
          </script>
          <script> $("#usual2").idTabs(); </script>
        <div class="gray_add_bottom">
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
   
        </div>
    </div>
  </div>
</div>

<?php break;
      case 'buy':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from $div where id=$id"));
$query=mysql_query("select * from member");


$query=mysql_query("select * from employee");
$employeelist=array();
while($value=mysql_fetch_array($query))
{
	$employeelist[$value['id']]=$value;
}
$query=mysql_query("select * from product order by id");
$pricelist=array();
$productlist=array();

while($value=mysql_fetch_array($query))
{
	$productlist[$value['id']]=$value;
	$pricelist[]=$value["price"];
}
$str=implode(",",$pricelist);

?>
<script language="JavaScript" type="text/javascript">
jQuery(document).ready(function($){
 var pricelist=[<?php echo $str;?>];
 $("#pricediv").html(pricelist[0]);
 $("#price").val(pricelist[0]);
 $("#product").bind('click change',function(){
	 //$("#price").val(pricelist[$(this).get(0).selectedIndex]);
	 //$("#price").attr("value",pricelist[$(this).get(0).selectedIndex]);
	 $("#pricediv").html(pricelist[$(this).get(0).selectedIndex]);
	 $("#price").val(pricelist[$(this).get(0).selectedIndex]);
	 
 });
});
</script>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Account</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="member_<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <input type="hidden" name="price" value id="price">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">
        
          
          <tr>
            <td height="35" align="right">Product Name:</td>
            <td ><select class="input_title_bg" name="product" id="product">
                <?php foreach($productlist as $product){ ?>
                <option value="<?php echo $product["id"];?>"><?php echo $product["title"];?></option>
                <?php } ?>
                 </select>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Price:</td>
            <td ><div class="input_title_bg" id="pricediv"/></div>
              </td>
          </tr>
          <tr>
            <td height="35" align="right">Quantity:</td>
            <td ><input name="quantity" type="text" class="input_title_bg"  value="<?php echo $row['quantity']?>"/>
              <span class="red">*</span></td>
          </tr>
          
          <tr>
            <td height="35" align="right">Employee Name:</td>
            <td ><select class="input_title_bg" name="employee">
                <?php foreach($employeelist as $employee){ ?>
                <option value="<?php echo $employee["id"];?>" <?php if($employee["id"]==$row["employeeid"]) echo "selected";?>><?php echo $employee["e_name"];?></option>
                <?php } ?>
                 </select>
              <span class="red">*</span></td>
          </tr>
          
          <tr>
            <td height="35" align="right">Selling time：</td>
            <td ><input type="text" name="sellingtime" id="sellingtime" value="<?php echo date("Y-m-d",$row['dateline'])?>"  onfocus="WdatePicker({el:$dp.$('sellingtime')})" class="input_title_bg"/>
              <span class="red">*</span></td>
          </tr>
          
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="<?php echo $id==''?'add':'edit'; ?>" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
      case 'Extra':
?>
<?php 
$id=$_REQUEST['id'];
$row = mysql_fetch_array(mysql_query("select * from product where id=$id"));
$query=mysql_query("select * from member");


$query=mysql_query("select * from employee");
$employeelist=array();
while($value=mysql_fetch_array($query))
{
	$employeelist[$value['id']]=$value;
}
$query=mysql_query("select * from product order by id");
$pricelist=array();
$productlist=array();

while($value=mysql_fetch_array($query))
{
	$productlist[$value['id']]=$value;
	$pricelist[]=$value["price"];
}
$str=implode(",",$pricelist);

?>
<script language="JavaScript" type="text/javascript">
jQuery(document).ready(function($){
 
});
</script>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Extra</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="product_<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table">         
          <tr>
            <td height="35" align="right">Type:</td>
            <td> <input type="radio" value="1" name="showtype" <?php if($row["show_type"]!=2){ ?>checked="checked"<?php } ?>>Exhibition<input type="radio" value="2" name="showtype" <?php if($row["show_type"]==2){ ?>checked="checked"<?php } ?>>Discount
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Title:</td>
            <td ><input name="title" type="text" class="input_title_bg" value="<?php echo $row["show_title"];?>"/>
              <span class="red">*</span></td>
          </tr>
          <tr>
            <td height="35" align="right">Content:</td>
            <td ><textarea name="content"  style="width:240px;height:120px"><?php echo $row["show_content"];?></textarea>
              <span class="red">*</span></td>
          </tr>
          
        </table>
        <div class="gray_add_bottom">
          <input type="submit" class="blue_submit_btn" style="margin-right:15px;" value="" />
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
          <input name="action" type="hidden" value="extra" />
          <input name="id" type="hidden" value="<?php echo $id?>" />
        </div>
      </form>
    </div>
  </div>
</div>
<?php break;
case details:
?>
<?php
    $id=$_REQUEST['id'];
    $query=mysql_query("select * from product where id=".$id); 
    $value=mysql_fetch_array($query);
?>
<div id="<?php echo $div?>_window">
  <div id="graybga"></div>
  <div class="class_list" id="class_list">
    <div class="window_header"><span class="window_title">Discount</span><span class="window_close"><a href="javascript:hidden_window()"></a></span></div>
    <div style="border-bottom:#CCC 1px dashed; height:1px;"></div>
    <div class="bktop" style="padding-left:51px;">
      <form action="product_<?php echo $div?>.php" method="post" name="form_w" id="form_w">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="full_add_table"> 
           <tr>
            <td height="35" align="right">Product:</td>
            <td> <?php echo $value["title"];?>
          </tr>        
          <tr>
            <td height="35" align="right">Ttile:</td>
            <td> <?php echo $value["show_title"];?>
          </tr>
          <tr>
            <td height="35" align="right">Details:</td>
            <td ><?php echo $value["show_content"];?>
          </tr>
          
        </table>
        <div class="gray_add_bottom">
          <input type="button" class="blue_back_btn" onclick="hidden_window()" value=""  />
        </div>
      </form>
    </div>
  </div>
</div>
<?php
} 
?>
